package thread;

import java.util.Scanner;

public class Test2 {
    public static void main(String[] args) {
        Thread thread = new Thread() {
            @Override
            public void run() {
                Scanner sc = new Scanner(System.in);
                System.out.println("请输入计时时间(秒):");
                System.out.println("计时开始");
                try {
                    for (int i = sc.nextInt(); i > 0; i--) {
                        System.out.println(i);
                        Thread.sleep(1000);
                    }
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("时间到");
            }
        };

        thread.start();

    }
}
